package com.laosg.framework.fhir.springboot;

import com.laosg.framework.fhir.springboot.service.PatientService;
import com.laosg.framework.fhir.springboot.util.JacksonUtil;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by kaimin on 4/7/2019.
 * time : 21:57
 */
@RestController
@RequestMapping("/patient")
public class Controller {

    @Autowired
    private PatientService patientService;

    @GetMapping
    public String get(){
        Patient patient = patientService.getById();
        String json = JacksonUtil.nonEmptyMapper().toJson(patient);
        return json;
    }
}
